﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ZHDJ.MobileInterface
{
    public partial class GetSystemUsers : AbstractBasePage
    {
        protected override OutParam BusinessProcess<InParam, OutParam>(InParam inParam)
        {
            // 业务逻辑返回的响应对象  
            GetSystemUsersOutParam result = new GetSystemUsersOutParam();
            GetSystemUsersInParam param = new GetSystemUsersInParam();
            string logMsg = "";
            bool isFlag = true;

            try
            {
                param = inParam as GetSystemUsersInParam;

                if (isFlag)
                {
                    DataSet ds = InterfaceHelper.GetSystemUsersData(param.LoginID, param.ModifyTime, param.page_no, param.page_count, param.CreateTime);

                    if (ds != null && ds.Tables.Count == 2)
                    {
                        UsersData itemTemp;
                        result.dataList.total_pages = CommonUtils.GetTotalPages(Convert.ToInt32(ds.Tables[0].Rows[0][0]), param.page_count);
                        foreach (DataRow dr in ds.Tables[1].Rows)
                        {
                            itemTemp = new UsersData();
                            itemTemp.LoginID = dr["LoginID"].ToString();
                            itemTemp.BranchID = dr["BranchID"].ToString();
                            itemTemp.BranchRight = dr["BranchRight"].ToString();
                            itemTemp.Post = dr["Post"].ToString();
                            itemTemp.Birthday = dr["Birthday"].ToString();
                            itemTemp.Educational = dr["Educational"].ToString();
                            itemTemp.NativePlace = dr["NativePlace"].ToString();
                            itemTemp.Nation = dr["Nation"].ToString();
                            itemTemp.PoliticsLineament = dr["PoliticsLineament"].ToString();
                            itemTemp.JoinPartyDate = dr["JoinPartyDate"].ToString();
                            itemTemp.BeRegularDate = dr["BeRegularDate"].ToString();
                            itemTemp.RewardsPunishment = dr["RewardsPunishment"].ToString();
                            itemTemp.DemocraticAppraisal = dr["DemocraticAppraisal"].ToString();
                            itemTemp.MobileNo = dr["MobileNo"].ToString();
                            itemTemp.IdentityCard = dr["IdentityCard"].ToString();
                            itemTemp.Email = dr["Email"].ToString();
                            itemTemp.QQNumber = dr["QQNumber"].ToString();
                            itemTemp.Address = dr["Address"].ToString();
                            itemTemp.UserName = dr["UserName"].ToString();
                            itemTemp.Gender = dr["Gender"].ToString();
                            itemTemp.OrderNo = dr["OrderNo"].ToString();
                            itemTemp.Password = dr["Password"].ToString();
                            itemTemp.IsPartyWorker = dr["IsPartyWorker"].ToString();
                            //itemTemp.IsAgree = dr["IsAgree"].ToString();
                            itemTemp.feitionNo = dr["feitionNo"].ToString();
                            itemTemp.isVolunteer = dr["isVolunteer"].ToString();
                            itemTemp.isPartyDeputy = dr["isPartyDeputy"].ToString();
                            itemTemp.isHardParty = dr["isHardParty"].ToString();
                            itemTemp.runSate = dr["runSate"].ToString();
                            itemTemp.WeiXinNo = dr["WeiXinNo"].ToString();
                            itemTemp.CreateTime = dr["CreateTime"].ToString();
                            itemTemp.ModifyTime = dr["ModifyTimeEx"].ToString();
                            itemTemp.BBSUserName = dr["BBSUserName"].ToString();
                            itemTemp.PartyCardNo = dr["PartyCardNo"].ToString();
                            itemTemp.WorkAddress = dr["WorkAddress"].ToString();
                            result.dataList.Data.Add(itemTemp);
                        }
                    }
                }
                logMsg = result.desc;
            }
            catch (Exception ex)
            {
                result.code = "0";
                result.desc = "操作异常，多次出现请联系管理员";
                logMsg = ex.Message + ":" + ex.StackTrace;
            }

            CommonUtils.InsertMobileInterfaceLog(SystemCode + "-GetSystemUsers", SerializeHelper.JsonSerializer<GetSystemUsersInParam>(param), logMsg);
            return result as OutParam;
        }

        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (string.Compare(Request.QueryString["Safe"], "False", true) == 0)
                ProcessRequest<GetSystemUsersInParam, GetSystemUsersOutParam>();
            else
                SafeProcessRequest<GetSystemUsersInParam, GetSystemUsersOutParam>();
        }
    }


    #region 请求参数
    public class GetSystemUsersInParam
    {
        /// <summary>
        /// 修改时间
        /// </summary>
        public string ModifyTime
        { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public string CreateTime
        { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        public string LoginID
        { get; set; }

        /// <summary>
        /// 必填 当前页
        /// </summary>
        public int page_no
        { get; set; }

        /// <summary>
        /// 必填，每页记录条数
        /// </summary>
        public int page_count
        { get; set; }
    }
    #endregion

    #region 结果参数
    public class GetSystemUsersOutParam
    {
        public GetSystemUsersOutParam()
        {
            code = "1";
            desc = "操作成功";
            dataList = new UsersDataList();
        }

        /// <summary>
        /// 返回结果 具体见接口返回对照码 1	成功 0	失败 2	请求非法 加密结果和传入的MD5字符串进行比较，如果相同则执行接口操作，否则返回1001错误响应码
        /// </summary>
        public string code
        { get; set; }

        /// <summary>
        /// 结果描述 成功和失败都需要
        /// </summary>
        public string desc
        { get; set; }

        public UsersDataList dataList
        { get; set; }



    }
    #region 获取组织列表
    public class UsersDataList
    {
        public UsersDataList()
        {
            total_pages = 0;
            Data = new List<UsersData>();
        }

        public List<UsersData> Data { get; set; }

        /// <summary>
        /// 总页数
        /// </summary>
        public int total_pages
        { get; set; }
    }

    /// <summary>
    /// 详细信息
    /// </summary>
    public class UsersData
    {
       #region 字段属性
        /// <summary>
        /// LoginID
        /// </summary>
        public string LoginID { get; set; }

        /// <summary>
        /// BranchID
        /// </summary>
        public string BranchID { get; set; }

        /// <summary>
        /// 组织负责人
        /// </summary>
        public string BranchRight { get; set; }

        /// <summary>
        /// 职务
        /// </summary>
        public string Post { get; set; }

        /// <summary>
        /// 生日
        /// </summary>
        public string Birthday { get; set; }

        /// <summary>
        /// 学历
        /// </summary>
        public string Educational { get; set; }

        /// <summary>
        /// 籍贯
        /// </summary>
        public string NativePlace { get; set; }

        /// <summary>
        /// 民族
        /// </summary>
        public string Nation { get; set; }

        /// <summary>
        /// 政治面貌
        /// </summary>
        public string PoliticsLineament { get; set; }

        /// <summary>
        /// 入党时间
        /// </summary>
        public string JoinPartyDate { get; set; }

        /// <summary>
        /// 转正时间
        /// </summary>
        public string BeRegularDate { get; set; }

        /// <summary>
        /// 奖惩情况
        /// </summary>
        public string RewardsPunishment { get; set; }

        /// <summary>
        /// 民主评议情况
        /// </summary>
        public string DemocraticAppraisal { get; set; }

        /// <summary>
        /// 手机
        /// </summary>
        public string MobileNo { get; set; }

        /// <summary>
        /// 身份证
        /// </summary>
        public string IdentityCard { get; set; }

        /// <summary>
        /// Email
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// QQNumber
        /// </summary>
        public string QQNumber { get; set; }

        /// <summary>
        /// UserName
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// Gender
        /// </summary>
        public string Gender { get; set; }
        /// <summary>
        /// OrderNo
        /// </summary>
        public string OrderNo { get; set; }
        /// <summary>
        /// Password
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// 是否党务工作着
        /// </summary>
        public string IsPartyWorker { get; set; }
        /// <summary>
        /// 是否志愿者
        /// </summary>
        //public string IsAgree { get; set; }

        /// <summary>
        /// 飞信号
        /// </summary>
        public string feitionNo { get; set; }

        /// <summary>
        /// 是否志愿者
        /// </summary>
        public string isVolunteer { get; set; }

        /// <summary>
        /// 是否党代表
        /// </summary>
        public string isPartyDeputy { get; set; }

        /// <summary>
        /// 是否困难党员
        /// </summary>
        public string isHardParty { get; set; }

        /// <summary>
        /// 党员类型
        /// 0:普通
        /// 1:历史（迁出）
        /// 2:流出
        /// 3:浏览账号
        /// </summary>
        public string runSate { get; set; }

        /// <summary>
        /// 微信帐号
        /// </summary>
        public string WeiXinNo { get; set; }       

        /// <summary>
        /// 修改时间
        /// </summary>
        public string CreateTime { get; set; }

        /// <summary>
        /// 修改时间
        /// </summary>
        public string ModifyTime{ get; set; }

        /// <summary>
        /// 论坛名称
        /// </summary>
        public string BBSUserName{ get; set; }

        /// <summary>
        /// 卡号
        /// </summary>
        public string PartyCardNo{ get; set; }

        /// <summary>
        /// 
        /// </summary>
        //public string UserType{ get; set; }

        /// <summary>
        /// 工作地址
        /// </summary>
        public string WorkAddress{ get; set; }

        /// <summary>
        /// 地址
        /// </summary>
        //public string CensusAddress{ get; set; }
       
       
       
       #endregion
    }
    #endregion



    #endregion
}